import requests

import config
from api.login_api import LoginApi


class EmpApi(object):
    def __init__(self):
        self.url = config.BASE_URL + '/api/sys/user'
        self.token = LoginApi().get_token()

    def emp_add_request(self, body):
        return requests.post(self.url, json=body, headers=self.token)

    def emp_query_request(self, path_parma):
        return requests.get(self.url + '/' + path_parma, headers=self.token)

    def emp_modify_request(self, path_parma, body):
        return requests.put(self.url + '/' + path_parma, json=body, headers=self.token)

    def emp_delete_request(self, path_parma):
        return requests.delete(self.url + '/' + path_parma, headers=self.token)
